package com.xm.controller;

import com.xm.pojo.Users;
import com.xm.service.UserService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

//下面方法不用写@responseBody,@RestController默认所有方法都含有@responseBody
@RestController
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public List<Users> userLogin(@RequestBody Users users){

        return userService.loginUser(users);
    }

    @RequestMapping("/queryUser")
    public List<Users> queryUser(){
        List<Users> users = this.userService.selectUserAllSerivce();
        return users;
    }

}
